]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ui: Theme lookup should respect XDG_DATA_DIRS
authorDidier Roche <didrocks@ubuntu.com>
Fri, 30 Mar 2018 07:44:14 +0000 (09:44 +0200)
committerDidier Roche <didrocks@ubuntu.com>
Mon, 16 Apr 2018 17:09:14 +0000 (19:09 +0200)
Modes, extensions and other GNOME Shell assets are searched in appropriate
subdirectories of each directory in XDG_DATA_DIRS, falling back
to global.datadir.
However, this isn't the case for themes, which are currently always expected
in global.datadir, even when referenced by a mode in a different XDG_DATA_DIR.

The fix is to have the theme finding pattern follow the same logic as other
elements.
Fixes #167.

js/ui/main.js

index 2cfe941be60091932d354fb33ee36f3233cba89e..d86cf9e8127535b7f78ab15945f59d4dfb5ee68a 100644 (file)
@@ -256,6 +256,14 @@ function _getStylesheet(name) {
     if (stylesheet.query_exists(null))
         return stylesheet;
 
+    let dataDirs = GLib.get_system_data_dirs();
+    for (let i = 0; i < dataDirs.length; i++) {
+        let path = GLib.build_filenamev([dataDirs[i], 'gnome-shell', 'theme', name]);
+        let stylesheet = Gio.file_new_for_path(path);
+        if (stylesheet.query_exists(null))
+            return stylesheet;
+    }
+
     stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
     if (stylesheet.query_exists(null))
         return stylesheet;